[#-- freemarker page demo --]

[#-- 本页面为物理分页,有Action控制--]
[#if pageSupport ??]
  [#assign x=(pageSupport.getTotalPage())!1 /]
  [#assign y=pageSupport.getCurrentPage() /]
  [#assign z=(page.pageSupport.getPageSize())!1 /]
  [#assign renderTo=(table.renderTo)!'' /]
 	<script type="text/javascript">//<![CDATA[
		// ajax分页：
		[#if ajax==true]
		var baseTable = (function(){
			function _addEventListeners() {
				$('a[page]').unbind('click').click(function() {
					var page = $(this).attr('page');
					$.get(baseTable.config.url, {'ajax':true, 'piece':true, 'currentPage':page}, function(data){
						//
						$(baseTable.config.renderTo).html(data);
						_addEventListeners();
						//
					})
				})
			}
			return {
				 config: {
                	url : null,
                	renderTo: null,
                    theme: null
                },
                init: function () {
                    _addEventListeners();
                }
			}
		}());
		$(function() {
			//var parent = $('#${table.id}').parent().html();
			baseTable.config.url = "${page.url}" ;
			baseTable.config.theme = '';
			baseTable.config.renderTo= "${renderTo!'#articleList'}";
			baseTable.init();
		})
		[/#if]
		//]]>
	</script>
	
[/#if]
	<table cellspacing="0" cellpadding="0" border="0" id="${table.id}" class="stdtable stdtablecb">
		[#if x lte 0]
			[#assign x=1]
		[/#if]
		[#if (table.columnList) ?? ]
        	<colgroup>
				[#list table.columnList as head]
					<col class="[#if head_index%2==0]con0[#else]con1[/#if]" />
					[#--<th class="${head.headerClass!''}">${head.title}</th>--]
				[/#list]
			</colgroup>
			<thead>
                <tr>
                [#list table.columnList as head]
					[#if head.headHtml??]
                		<th class="[#if head_index%2==0]head0[#else]head1[/#if] ${head.headerClass!''}">${head.headHtml}</th>
                	[#else]
                		<th class="[#if head_index%2==0]head0[#else]head1[/#if] ${head.headerClass!''}">${head.title}</th>
                	[/#if]
				[/#list]
                </tr>
			</thead>
			<tfoot>
                <tr>
                [#list table.columnList as foot]
                	[#if foot.footHtml??]
                		<th class="[#if foot_index%2==0]head0[#else]head1[/#if] ${foot.headerClass!''}">${foot.footHtml}</th>
                	[#else]
                		<th class="[#if foot_index%2==0]head0[#else]head1[/#if] ${foot.headerClass!''}">${foot.title}</th>
                	[/#if]
				[/#list]
                </tr>
			</tfoot>
			<tbody>
				[#--[#assign blank=z/]--]
				[#list table.source as target]
					<tr>
						[#list table.columnList as column]
							[#if column.innerHtml?? ]
								<td class="${column.columnClass}" [#if column.property ??]tval="${displayer.property("[${target_index}].${column.property}", "")}"[/#if] >
									${displayer.property("${column.innerHtml}", target_index)}
								</td>
							[#else]
								<td class="${column.columnClass}">
									${displayer.property("[${target_index}].${column.property}", "${column.format}")}
								</td>
							[/#if]
						[/#list]
					</tr>
					[#--[#assign blank=z-target_index> --]
				[/#list]
				[#-- 不足分页内容,补齐空白行
				[#list 1..blank as t]
					<tr>
						[#list table.columnList as column]
							<td class="${column.columnClass}">
								&nbsp;
							</td>
						[/#list]
					</tr>
				[/#list] --]
			</tbody>
		[/#if]
	</table>
	<div class="dataTables_info" id="dyntable_info">Showing 1 to 10 of 51 entries</div>
	<div class="dataTables_paginate paging_full_numbers" id="dyntable_paginate">
		[#--<span class="first paginate_button paginate_button_disabled" id="dyntable_first">First</span>
		<span class="previous paginate_button paginate_button_disabled" id="dyntable_previous">Previous</span>--]
		<a class="previous paginate_button paginate_button_disabled" target="${page.target}" page="1" [#if ajax==true]href="javascript:void(0);"[#else]href="${page.getPageUrl(1)}"[/#if]>${displayer.getMessage("page.first")}</a>
		[#if pageSupport.isFirst() ]
			<span class="previous paginate_button paginate_button_disabled" id="dyntable_previous">${displayer.getMessage("page.previous")}</span>
		[#else]
			<a class="previous paginate_button paginate_button_disabled" target="${page.target}" page="${y-1}" [#if ajax==true]href="javascript:void(0);"[#else]href="${page.getPageUrl(y-1)}"[/#if]>${displayer.getMessage("page.previous")}</a>
		[/#if]
		<span>
			[#list 1..x as i]
		 		[#if i == y]
		 			<span class="paginate_active">${i}</span>
		 		[#else]
		 			<a class="paginate_button" target="${page.target}" page="${i}" [#if ajax==true]href="javascript:void(0);"[#else]href="${page.getPageUrl(i)}"[/#if]>${i}</a>
		 		[/#if]
		 	[/#list]
			[#--<span class="paginate_active">1</span>
			<span class="paginate_button">2</span>
			<span class="paginate_button">3</span>
			<span class="paginate_button">4</span>
			<span class="paginate_button">5</span>
			<span class="next paginate_button" id="dyntable_next">Next</span>
			<span class="last paginate_button" id="dyntable_last">Last</span>
			--]
		</span>
		
		[#if pageSupport.isLast()]
		 	<span class="next paginate_button">${displayer.getMessage("page.next")}</span>
		[#else]
		 	<a class="next paginate_button" target="${page.target}" class="s1" page="${y+1}" [#if ajax==true]href="javascript:void(0);"[#else]href="${page.getPageUrl(y+1)}"[/#if]>${displayer.getMessage("page.next")}</a>
		[/#if]
		<a class="previous paginate_button paginate_button_disabled" target="${page.target}" page="${x}" [#if ajax==true]href="javascript:void(0);"[#else]href="${page.getPageUrl(x)}"[/#if]>${displayer.getMessage("page.last")}</a>
	</div>
	[#--
	[#if pageSupport ??]
		<table class="page-table" align="center" id='${pageId}'>
			<tr>
				<td class="page-td">
					[#if pageSupport.isFirst() ]
						<span class="page-td-p page-disable">${displayer.getMessage("page.previous")}</span>
					[#else]
						<a class="page-td-p" target="${page.target}" page="${y-1}" [#if ajax==true]href="javascript:void(0);"[#else]href="${page.getPageUrl(y-1)}"[/#if]>${displayer.getMessage("page.previous")}</a>
					[/#if]
					[#list 1..x as i]
				 		[#if i == y]
				 			<span class="page-td-p page-selected">${i}</span>
				 		[#else]
				 			<a class="page-td-p" target="${page.target}" page="${i}" [#if ajax==true]href="javascript:void(0);"[#else]href="${page.getPageUrl(i)}"[/#if]>${i}</a>
				 		[/#if]
				 	[/#list]
					[#if pageSupport.isLast()]
					 	<span class="page-td-p page-disable">${displayer.getMessage("page.next")}</span>
					[#else]
					 	<a class="page-td-p" target="${page.target}" class="s1" page="${y+1}" [#if ajax==true]href="javascript:void(0);"[#else]href="${page.getPageUrl(y+1)}"[/#if]>${displayer.getMessage("page.next")}</a>
					[/#if]
					<span class="page-td-p page-disable">共${x}页</span>
					<div class="clear"></div>
				</td>
			</tr>
		</table>
	[/#if]--]